<template>
  <div>
    <van-tabs v-model:active="active">
      <van-tab title="关注"><Follow /></van-tab>
      <van-tab title="发现">
        <Discover />
      </van-tab>
      <van-tab :title="city"><Orientation /></van-tab>
    </van-tabs>
  </div>
</template>

<script setup name="HomeView">
import { onMounted, ref } from "vue";
import Discover from "../pages/jsj/Discover.vue";
import Follow from "../pages/jsj/Follow.vue";
import Orientation from "../pages/jsj/Orientation.vue";
import AMapLoader from "@amap/amap-jsapi-loader";
const active = ref(1);
const city = ref("");
const position = async () => {
  window._AMapSecurityConfig = {
    securityJsCode: "31b5edf6379f1c827a45d9816acf0212",
  };
  AMapLoader.load({
    key: "949d029d982bcde21d69a6824d6d90bf", // 替换为你的Key
    version: "2.0", // 高德地图API版本
    plugins: ["AMap.PlaceSearch", "AMap.CitySearch"], // 需要加载的插件列表
  })
    .then((AMap) => {
      AMap.plugin("AMap.CitySearch", function () {
        var citySearch = new AMap.CitySearch();
        citySearch.getLocalCity(function (status, result) {
          city.value = result.city;
        });
      });
    })
    .catch((e) => {
      console.log(e);
    });
};
onMounted(() => {
  position();
});
</script>

<style scoped>

</style>
